\ProvidesPackage{lonac}[2024/02/09]
\RequirePackage{xeCJKfntef}
\RequirePackage{fancyhdr}
\RequirePackage[table]{xcolor}
\RequirePackage{listings}
\RequirePackage[left=2cm, right=2cm, bottom=2cm, headheight=14pt,marginparwidth={3cm},marginparsep={2cm},vmargin={2.5cm}]{geometry}
\usepackage{changepage}
\RequirePackage{tcolorbox}
\RequirePackage{framed}
\RequirePackage[open, openlevel=2, atend]{bookmark}
\RequirePackage{hyperref}
\RequirePackage{ifthen}

\setCJKmainfont[BoldFont=SimHei,ItalicFont=KaiTi]{SimSun}

\providecolor{牛角灰}{HTML}{2d2e36}
\providecolor{虹蓝}{HTML}{2177b8}
\providecolor{品红}{HTML}{ef3473}
\providecolor{瀑布蓝}{HTML}{51c4d3}
\providecolor{麦苗绿}{HTML}{55bb8a}
\providecolor{嫩菊绿}{HTML}{f0f5e5}
\providecolor{金驼}{HTML}{e46828}
\providecolor{狼烟灰}{HTML}{5d655f}
\providecolor{胆矾蓝}{HTML}{0f95b0}
\providecolor{海天蓝}{HTML}{c6e6e8}
\providecolor{珍珠灰}{HTML}{e4dfd7}
\providecolor{橄榄黄绿}{HTML}{bec936}
\providecolor{海沬绿}{HTML}{e2e7bf}
\providecolor{魏紫}{HTML}{7e1671} 
\providecolor{青莲}{HTML}{8b2671}
\providecolor{海王绿}{HTML}{248067}
\providecolor{玉鈫蓝}{HTML}{126e82}

\colorlet{FontColor}{牛角灰}
\colorlet{PrimaryColor}{虹蓝}

\colorlet{Tips-Front}{虹蓝}
\colorlet{Warn-Front}{金驼}
\colorlet{Quote-Front}{狼烟灰}

\colorlet{Prob-Front}{海王绿}
\colorlet{Prob-Back}{嫩菊绿}

\colorlet{Intro-Front}{胆矾蓝}
\colorlet{Intro-Back}{海天蓝}
\colorlet{Solution-Front}{海王绿}


\ctexset{
  today=big,
  contentsname={目录},
  section/format=\LARGE\bfseries\centering\color{PrimaryColor},
  section/number={\textcolor{PrimaryColor}{\thesection}},
  subsection/number={\textcolor{PrimaryColor}{\thesubsection}},
  subsubsection/number={\textcolor{PrimaryColor}{\thesubsubsection}},
}

\tcbuselibrary{listings}
\lstset{
  frame=shadowbox,
  framesep=1pt,
  framextopmargin=6pt,
  framexbottommargin=6pt,
  framexleftmargin=6pt,
  tabsize=4,
  breaklines=true,
  upquote=true,
  captionpos=b,
  basicstyle=\normalsize,
  rulecolor=\color{PrimaryColor},
  rulesepcolor=\color{PrimaryColor},
  identifierstyle=\color{PrimaryColor},
  commentstyle=\itshape\color{狼烟灰},
  stringstyle=\bfseries\color{魏紫},
  keywordstyle=[1]\bfseries\color{青莲},
  keywordstyle=[2]\bfseries\color{品红},
  keywordstyle=[3]\bfseries\color{海王绿},
  keywordstyle=[4]\bfseries\color{玉鈫蓝},
  keywordstyle=[5]\color{PrimaryColor},
  numberstyle=\bfseries\color{PrimaryColor},
}
\lstdefinelanguage{c++}{
  morekeywords=[1]{if, else, case, switch, break, continue, for, while, do, return, using, true, false, goto, inline, new, typedef, register, extern, public, private},
  morekeywords=[2]{class, namespace, struct, template, string, sizeof},
  morekeywords=[3]{int, float, double, long, char, auto, void, enum, signed, unsigned},
  morecomment=[l]{//},
  morecomment=[s]{/*}{*/},
  morestring=[b]',
  morestring=[b]",
}
\lstalias{cpp}{c++}
\lstalias{cpp}{c++}
\pagestyle{fancy}
\fancyfoot[L]{\kaishu{\rightmark}}
\fancyfoot[C]{}
\fancyfoot[R]{\thepage}
\fancyhead[L]{}
\fancyhead[C]{Lon.AC NOI\kaishu{ 大纲知识点拆解学习}}
\fancyhead[R]{}
\renewcommand{\headrule}{\hrule width\textwidth}

\tcbuselibrary{theorems}
\tcbuselibrary{skins}
\tcbsetforeverylayer{enhanced}

\providecommand\code[1]{%
  {\ttfamily{\textcolor{品红}{#1}}}%
}

\newtcolorbox{problem}[1]{
  fonttitle=\heiti,
  boxrule=0.1mm,
  colback=Prob-Back,
  before upper={\parindent2em},
  colframe=Prob-Front,
  attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
  boxed title style={colback=Prob-Front},
  title={#1}
}

\newtcolorbox{point}{
  fonttitle=\heiti,
  boxrule=0.1mm,
  colback=Prob-Back,
  before upper={\parindent2em},
  colframe=Prob-Front,
  attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
  boxed title style={colback=Prob-Front},
  title=对应大纲考点
}

\newenvironment{formal}[2][]{%
    \def\FrameCommand{%
        \hspace{1pt}%
        {\color{#1}\vrule width 2pt}%
        {\color{#2}\vrule width 4pt}%
        \colorbox{#2}%
    }%
    \MakeFramed{\advance\hsize-\width\FrameRestore}%
    \noindent\hspace{-4.55pt}%
    \begin{adjustwidth}{}{7pt}\vspace{2pt}\vspace{2pt}}{%
        \vspace{2pt}\end{adjustwidth}\endMakeFramed%
}
\newlength{\la}
\newlength{\lb}
\newlength{\lc}
\newlength{\ld}
\newlength{\lhalf}
\newlength{\lquarter}
\newlength{\lmax}
\newcommand{\xx}[4]{\\[.5pt]%
\settowidth{\la}{A.~#1~~~}
\settowidth{\lb}{B.~#2~~~}
\settowidth{\lc}{C.~#3~~~}
\settowidth{\ld}{D.~#4~~~}
\ifthenelse{\lengthtest{\la > \lb}} {\setlength{\lmax}{\la}} {\setlength{\lmax}{\lb}}
\ifthenelse{\lengthtest{\lmax < \lc}} {\setlength{\lmax}{\lc}} {}
\ifthenelse{\lengthtest{\lmax < \ld}} {\setlength{\lmax}{\ld}} {}
\setlength{\lhalf}{0.5\linewidth}
\setlength{\lquarter}{0.25\linewidth}
\ifthenelse{\lengthtest{\lmax > \lhalf}} {\noindent{}A.~#1 \\ B.~#2 \\ C.~#3 \\ D.~#4 } {
\ifthenelse{\lengthtest{\lmax > \lquarter}} {\noindent\makebox[\lhalf][l]{A.~#1~~~}%
\makebox[\lhalf][l]{B.~#2~~~} \\ %
\noindent \makebox[\lhalf][l]{C.~#3~~~}%
\makebox[\lhalf][l]{D.~#4~~~}}%
{\noindent\makebox[\lquarter][l]{A.~#1~~~}%
\makebox[\lquarter][l]{B.~#2~~~}%
\makebox[\lquarter][l]{C.~#3~~~}%
\makebox[\lquarter][l]{D.~#4~~~}}}}

\newtcolorbox{colorbox2}[1]{
  skin=empty,
  top=0pt,
  bottom=0pt,
  toprule=0pt,
  bottomrule=0pt,
  leftrule=0pt,
  rightrule=0pt,
  borderline west={2pt}{0pt}{#1},
}
\newenvironment{tips}
{\begin{colorbox2}{Tips-Front}
    \textcolor{Tips-Front}{\heiti{提示：}}
}
{\end{colorbox2}}
\newenvironment{solution}
{\begin{colorbox2}{Solution-Front}
    \textcolor{Solution-Front}{\heiti{解析：}}
}
{\end{colorbox2}}
\newenvironment{intro}{\begin{formal}[Intro-Front]{Intro-Back}}{\end{formal}}
